package com.example.arithmeticleetcode.leetcode.July;

/**
 * @program: arithmetic-leetcode
 * @description: 1523. 在区间范围内统计奇数数目
 * @author: FangZhen
 * @create: 2020-07-28 11:16
 **/
public class Demo11 {

    public static void main(String[] args) {
        System.out.println(countOdds(3, 7));
        System.out.println(countOdds(8, 10));
        System.out.println(countOdds(407656828, 722359384));

        System.out.println(4 % 2);
        System.out.println(7 % 2);
        System.out.println(4 % 2 | 7 % 2);
        System.out.println(0 | 1);
        System.out.println(1 | 1);
        System.out.println(1 | 0);
        System.out.println(0 | 0);
    }

    public static int countOdds(int low, int high) {
        int count = 0;
        while (low <= high) {
            if (low++ % 2 != 0) {
                count++;
            }
        }
        return count;
    }
}
